﻿using System;

namespace SvnAPI.Base.Exception
{
    /// <summary>
    /// Represents errors that occur during execution of specific command on svn tool.
    /// </summary>
    [Serializable]
    sealed class CommandException : System.Exception
    {
        #region Constants

        /// <summary>
        /// Constant to define the error message to show.
        /// </summary>
        const String message = "Please define correctly the 'SVN_SERVER' environment variable.";

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the System.Exception class with a specified error message.
        /// </summary>
        /// <param name="command">Command to get the name.</param>
        /// <param name="fileName">The message that describes the error.</param>
        public CommandException(Object command, string fileName)
            : base(String.Format("{0}. {1} needs the executable, but the file doesn't exists: {2}", message, command.GetType().Name, fileName))
        {
        }        

        #endregion
    }
}
